<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>Demo | PHP Gamercard API</title>
	<style type="text/css">
	  body { font-family:Verdana, Arial, Helvetica, sans-serif; padding:10px; margin:0; color:#333; }
	  #gamertag-search { text-align:center; border-bottom:1px solid #ccc; border-top:1px solid #ccc; padding:1em; }
	  h1.title { text-align:center; }
	  pre { height:25em; overflow:scroll; border:1px solid #333; }
	  .block { width:50%; float:left; }
	</style>
</head>

<body>

  <h1 class="title">PHP Gamercard API Demo</h1>

  <?php 
  // General setup:
  // Include the Gamercard API and make a new Gamercard object
  require_once('../src/Gamercard.php');
  $gamertag = $_REQUEST['gamertag'] ? $_REQUEST['gamertag'] : 'Major Nelson';
  $gamercard = new Gamercard($gamertag);
  ?>
  
  <!-- Form for user-submitted Gamertag -->
  <form id="gamertag-search" method="GET" action="<?php print $_SERVER['PHP_SELF']; ?>">
    <input type="text" name="gamertag" value="<?php print $gamertag; ?>" />
    <input type="submit" value="Retrieve Gamertag data" />
  </form>
  
  <!-- Render a Gamercard -->
  <div class="block">
  <h2>Rendered Gamercard</h2>
  <?php print $gamercard->render(); ?>
  </div>
  
  <!-- Retrieve and print Gamercard data object -->
  <div class="block">
  <h2>Gamercard web service data result</h2>
  <pre>
    <?php print_r($gamercard->data()); ?>
  </pre>
  </div>

</body>
</html>